class_name  inputCmd
extends Node
var set_the_contral_authority :bool=true
@onready var atk=$ATK/t
@onready var virtual_joystick: VirtualJoystick = $virtual_joystick

@export var inputCmd_atk:bool=false
@export var inputCmd_directionX:float#转向
@export var inputCmd_directionY:float#前进后腿
@export var inputCmd_vector2:=Vector2.ZERO

@onready var label: Label = $virtual_joystick/Base2/Label


func input():
	inputCmd_vector2=virtual_joystick.output
	
	
	
func _process(_delta: float) -> void:
	set_contral_authority()
	if is_multiplayer_authority():
		input()
func set_contral_authority():
	if set_the_contral_authority:
		set_the_contral_authority=false
		set_multiplayer_authority(get_parent().name.to_int())
		label.text=str(get_multiplayer_authority())
		print("  输入控制器权限    "+str(get_multiplayer_authority()))
		print("  yaogan权限    "+str(virtual_joystick.get_multiplayer_authority()))
		if not is_multiplayer_authority():
			atk.position.x=300
			atk.visible=true
			virtual_joystick.position.x=300
			virtual_joystick.visible=true



func _on_t_pressed发射子弹() -> void:
	
	inputCmd_atk=true# Replace with function body.
